package woa.test;

import java.util.*;

public class BrotherWords {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()){
            int num = in.nextInt();
            List<String> datas = new ArrayList();
            for(int i = 0 ; i < num ; i++){
                datas.add(in.next());
            }
            String x = in.next();
            char[] xs = x.toCharArray();//取反
            int index = in.nextInt();
            Collections.sort(datas);
            int count = 0;
            String k = "";
            for(String str : datas){
                if(x.equals(str) || x.length() != str.length()){
                    continue; //字符串一样 和 长度不一样的跳过
                }
                char[] strs = str.toCharArray();
                Arrays.sort(xs);
                Arrays.sort(strs);
                if(!Arrays.equals(strs,xs)){
                    continue;//升序排序不相等，跳过
                }
                System.out.println(str);
                count += 1; // 满足条件的累加
                if (count == index) {
                    k = str;//第K个兄弟单词
                }
            }
            System.out.println(count);
            System.out.println(k);
        }
    }
}
